package com.category.app.controller;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.category.app.service.CategoryService;
import com.tamll.bean.Category;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
public class CategoryController {

    @Autowired
    private CategoryService categoryService;

    //查询所有分类
    @GetMapping("Category")
    public Page<Category> Category(@RequestParam(defaultValue = "0") Integer pageNumber, @RequestParam(defaultValue = "10") Integer num){
        Page<Category> list = categoryService.getList(pageNumber,num);
        return list;
    }

    public List<Category> GetCategory (@PathVariable Integer categoryId){
        Category categoryA = categoryService.SelectCategory(categoryId);
        return null;
    }
}
